package com.aqie.easy.bitOperation;

/**
 * 1009 十进制整数的反码
 * todo
 */
public class BitwiseComplement {
    public int bitwiseComplement(int N) {
        if (N == 0) return 1;
        int num = 1;
        while (num <= N) num <<= 1;
        return num - 1 - N;
    }
}
